﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace BackupAssurance.Library.XML
{
      public static class fXMLParser
    {
        public static Dictionary<string, string> ConvertXMLtoDictionary(string inputtext)
        {
            Dictionary<string, string> dic = new Dictionary<string, string>();
            inputtext = "<data>" + inputtext + "</data>";

            XmlDocument xml = new XmlDocument();
            xml.LoadXml(inputtext);

            XmlNodeList resources = xml.SelectNodes("data/resource");
            //SortedDictionary<string, string> dictionary = new SortedDictionary<string, string>(); 

            foreach (XmlNode node in resources)
            {
                dic.Add(node.Attributes["key"].Value.ToUpper(), node.InnerText);
            }

            return dic;
        }
    }
}
